/**
 * 
 */
package functii.elementare;

import Interpretor.Context;
import operatori.Impartit;
import operatori.Ori;

public class Radical extends Putere {

	/*
	 * radical(x) = 1 / x^2
	 */
	public Radical() {
		super();
	}

	public String toString() {
		if (fStang == null)
			System.exit(1);
		return concatTermeni(fStang.toString(), "2");
	}

	public static String concatTermeni(String aux1, double exp) {
		return "(" + aux1 + ")" + "^" + exp;
	}
	public void interpret(Context cont) {
		cont.actual(this);
	}
	/*
	public static double Calcul(double baza) {
		if (baza < 0) {
			System.err.println("error: Invalid input for sqrt function");
			System.exit(1);
		}
		return Math.sqrt(baza);
	}

	public double calcul() {
		if (fStang == null)
			System.exit(1);
		return Calcul(fStang.calcul());
	}

	public double calculDerivata() {
		if (fStang == null)
			System.exit(1);
		return Impartit.Calcul(Ori.Calcul(exponent, fStang.calculDerivata()),
				Radical.Calcul(fStang.calcul()));
	}

	public String derivare() {
		if (fStang == null)
			System.exit(1);
		return Impartit.ConcatTermeni(Ori.ConcatTermeni(String
				.valueOf(exponent), fStang.derivare()), Radical.concatTermeni(
				fStang.toString(), 1.0 / 2.0));
	}
*/
}
